Skip to content

Fix compatibility with PG13. #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2020
Merged

Conversation

rjuju
Copy link
Contributor

@rjuju rjuju commented Jun 22, 2020

planner_hook now requires the input query_string, and tag_hash isn't
automatically available anymore with the existing includes.

planner_hook now requires the input query_string, and tag_hash isn't
automatically available anymore with the existing includes.
@ololobus
Copy link
Contributor

Hi Julien, thank you for your contribution. These changes look fine for me, it compiled well and existing tests passed. So I am going to merge it

@ololobus
Copy link
Contributor

BTW, I have found existing tests to be very limited, so I added some trivial checks just to be sure that all pg_wait_sampling user functions work well and return something — a1a340f.

However, it fails for 9.6 — https://travis-ci.org/github/postgrespro/pg_wait_sampling/jobs/701312916#L641

I checked it manually with REL9_6_STABLE and found that pg_wait_sampling_get_profile / pg_wait_sampling_get_history always return an empty set for me, pg_wait_sampling tables are always empty as well. Shared pg_wait_sampling library is loaded and I do everything in the same way as for the newer versions.

@rjuju, have you ever used pg_wait_sampling with 9.6? I mean the current master and some of the latests releases.

@rjuju
Copy link
Contributor Author

rjuju commented Jun 23, 2020

I just tried on 9.6 (commit 22dcb6c206) and pg_wait_sampling commit 4c7549e:

I did a lock table t1 and select * from t1 on another session, then

=# select version();
                                                            version
--------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 9.6.17@22dcb6c206 on x86_64-apple-darwin18.7.0, compiled by Apple clang version 11.0.0 (clang-1100.0.33.17), 64-bit
(1 row)

=# select * from pg_wait_sampling_get_history() limit 1;
  pid  |              ts               | event_type |  event   | queryid
-------+-------------------------------+------------+----------+---------
 28566 | 2020-06-23 17:35:51.063678+02 | Lock       | relation |       0
(1 row)

=# select * from pg_wait_sampling_get_profile();
  pid  | event_type |  event   | queryid | count
-------+------------+----------+---------+-------
 28566 | Lock       | relation |       0 | 12799
(1 row)

I'm not sure why you got failure on 9.6 and 9.6 only.

@ololobus
Copy link
Contributor

ololobus commented Jun 23, 2020

Thanks! OK, I got it. In the newer versions (>9.6) there are idle state wait events like Activity, Client (PG_WAIT_ACTIVITY, PG_WAIT_CLIENT), so pg_wait_sampling reports are always non-empty. However, in the 9.6 there are none of them, so you have to create an explicit lock waiting event like you described to get some info in the reports. So the problem was with my new test

@ololobus ololobus merged commit 8440edd into postgrespro:master Jun 23, 2020
@rjuju
Copy link
Contributor Author

rjuju commented Jun 23, 2020

Oh indeed, that makes sense!

Thanks a lot for investigating and merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants